/*
day356 
2020.8.18 
*/
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;


class Solution {
public:
    int minIncrementForUnique(vector<int>& A) {
    	if(A.empty())
    	{
    		return 0;
		}
		sort(A.begin(),A.end());
		
		int max=A.front()+1,res=0;
		for(int i=1;i<A.size();++i)
		{
			if(A[i]<max)
			{
				res+=(max-A[i]);
				max+=1;
			}
			else
			{
				max=A[i]+1;
			}
		}
		
		return res;
    }
};

int main()
{
	return 0;
}
